|
EBI Java Tools and
Utils Version 2.2a | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--embl.ebi.tools.Regex.RegExpCore
|
+--embl.ebi.tools.Regex.RegExp
A class that handles basic regular expressions.
This package was written by MAEDA Shugo. The original name of the package is JP.ac.osaka_u.ender.util.regex. Here is the substantial part of the original README file:
*** Package JP.ac.osaka_u.ender.util.regex ***
Copyright (C) 1997 MAEDA Shugo
Version 0.11 Apr. 13, 1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation.
You can get the latest version on my web page.
URL: http://www.pic-internet.or.jp/user/kojin/ender/
Reference Books
Kondo Yoshiyuki, "Alogorithms and Data Structures for C Programers", SOFTBANK BOOKS, 1993
Ed Tittel, Mark Gaither, "60 Minute Guide to Java", SOFTBANK BOOKS, 1996
Black Monkey, RegExp.pas Version 0.15 for Delphi2, 1996
I have made only the following changes:
See
RegExp A class that implements pattern matching with regular expressions MatchInfo A class that is used in the class RegExp to return patern matching infomations RegExpSyntaxException Signals that the regular expression is invalid NFABuildException Signals an exception has occured when building NFA
TestRegex
or Substitutor
for examples how to use RegExp.
X character itself XY cocatenation X|Y selection X* closure X+ X|X* X? X|() [XYZ] X|Y|Z [h-n] h|i|j...n [^XYZ] not [XYZ] . any one character ^ beginning of string $ end of string \0 0 \t tabulator \r carriage return \n newline \d [0-9] \D [^0-9] \s [ \t\r\n] \S [^ \t\r\n] \w [0-9A-Z_a-z] \W [^0-9A-Z_a-z]
TestRegex| Constructor Summary | |
RegExp()
Constructs a RegExp instance. | |
RegExp(java.lang.String pattern)
Constructs a RegExp instance with the specified regular expression. | |
| Method Summary | |
java.lang.String |
dfaString()
|
MatchInfo[] |
globalMatch(java.lang.String text)
Global pattern match. |
MatchInfo |
match(java.lang.String text)
Pattern match with the current specified regular expression. |
MatchInfo |
match(java.lang.String text,
int begin, int end)
Pattern match with the current specified regular expreshassion. |
java.lang.String |
nfaString()
|
java.lang.String |
pattern()
|
void |
setPattern(java.lang.String pattern)
Sets the regular expression string. |
java.lang.String[] |
split(java.lang.String text)
Splits a text by the matched strings. |
java.lang.String |
substitute(java.lang.String text,
java.lang.String replacement, boolean global)
Substitutes subText for matched strings. |
java.lang.String |
toString()
|
java.lang.String |
treeString()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait,
wait |
| Constructor Detail |
public RegExp()
public RegExp(java.lang.String pattern)
throws RegExpSyntaxException,
NFABuildException
| Method Detail |
public MatchInfo match(java.lang.String text)
text - the target text.
public MatchInfo match(java.lang.String text,
int begin,
int end)
text - the target text.
begin - the begining index for the target.
end - the ending index for the target.
public MatchInfo[] globalMatch(java.lang.String text)
text - the target text.
public java.lang.String[] split(java.lang.String text)
text - the target text.
public java.lang.String substitute(java.lang.String text,
java.lang.String replacement,
boolean global)
text - the target text.
global - if true substitutes for all matched
strings.public void setPattern(java.lang.String pattern)
throws RegExpSyntaxException,
NFABuildException
RegExpSyntaxException
- If the regular expression syntax is invalid.
NFABuildExceptionpublic java.lang.String pattern()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String treeString()
public java.lang.String nfaString()
public java.lang.String dfaString()
|
EBI Java Tools and
Utils Version 2.2a | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||